package 面向对象_特征4;

public class 面向对象_3_等于和equals实例 {
    int ld;
    String name;

    public 面向对象_3_等于和equals实例(int id,String name){
        this.ld = id;
        this.name = name;
    }

    public String getName() {
        return name;
    }
    public int getLd() {
        return ld;
    }
    public void setName(String name) {
        this.name = name;
    }
    public void setLd(int ld) {
        this.ld = ld;
    }
    @Override
    public boolean equals(Object obj){
        boolean flog = false;
        if (obj instanceof 面向对象_3_等于和equals实例){
            面向对象_3_等于和equals实例 o = (面向对象_3_等于和equals实例) obj;
            if (this.ld == o.ld &&this.name.equals(o.name)){
                    flog = true;
            }
        }

        return flog;
    }

}
